package com.hqyj.module.leave.dao;

import com.hqyj.module.leave.pojo.HolidayInfo;
import com.hqyj.module.leave.pojo.SearchBean;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
@Mapper
public interface HolidayDao {

    @Select("select * from holiday")
    List<HolidayInfo> allHolidayInfo(SearchBean searchBean);

    @Select("select * from holiday where user_id = #{userId}")
    HolidayInfo holidayInfo(int userId);

    @Insert("insert into holiday (user_id,user_name,thing,start_time,end_time,ho_type) values (#{userId},#{userName},#{thing},#{startTime},#{endTime},#{hoType})")
    @Options(useGeneratedKeys = true, keyColumn = "id", keyProperty = "id")
    void insertHolidayInfo(HolidayInfo holidayInfo);

    @Update("update holiday set verify_id = #{verifyId},suggestion=#{suggestion} where id = #{id}")
    void leaderUpdateHolidayInfo(HolidayInfo holidayInfo);

    @Delete("delete from holiday where id = #{id}")
    void deleteHolidayInfo(int id);

    @Update("update holiday set user_id=#{userId},user_name=#{userName},thing=#{thing},start_time=#{startTime},end_time=#{endTime},ho_type=#{hoType} where id=#{id}")
    void updateHolidayInfo(HolidayInfo holidayInfo);
}

